﻿using System;
using System.Collections.Generic;
using KKSG;
using XUpdater;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x02001149 RID: 4425
	internal class Process_PtcG2C_SelectRoleNtf
	{
		// Token: 0x0600D9EF RID: 55791 RVA: 0x0032BF54 File Offset: 0x0032A154
		public static void Process(PtcG2C_SelectRoleNtf roPtc)
		{
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process " + roPtc.Data.ToString(), null, null, null, null, null);
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process " + roPtc.Data.roleData.ToString(), null, null, null, null, null);
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process " + roPtc.Data.roleData.Brief.ToString(), null, null, null, null, null);
			XSingleton<XGame>.singleton.PlayerID = roPtc.Data.roleData.Brief.roleID;
			List<SkillInfo> skills = null;
			List<uint> skillSlot = null;
			uint skillPageIndex = 0U;
			if (roPtc.Data.roleData.skill != null)
			{
				skills = ((roPtc.Data.roleData.skill.index == 0U) ? roPtc.Data.roleData.skill.Skills : roPtc.Data.roleData.skill.SkillsTwo);
				skillSlot = ((roPtc.Data.roleData.skill.index == 0U) ? roPtc.Data.roleData.skill.SkillSlot : roPtc.Data.roleData.skill.SkillSlotTwo);
				skillPageIndex = roPtc.Data.roleData.skill.index;
			}
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process2 ", null, null, null, null, null);
			XSingleton<XAttributeMgr>.singleton.InitPlayerAttr(roPtc.Data.roleData.Brief, roPtc.Data.roleData.Attributes, skills, skillSlot, skillPageIndex, roPtc.Data.roleData.system, roPtc.Data.roleData.military);
			XOptionsDocument specificDocument = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
			specificDocument.InitServerConfig(roPtc.Data.roleData.config);
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process3 ", null, null, null, null, null);
			XSingleton<XItemDrawerMgr>.singleton.Init((uint)roPtc.Data.roleData.Brief.type);
			XSingleton<XGameSysMgr>.singleton.InitWhenSelectRole(roPtc.Data.roleData.Brief.level);
			XSingleton<XGame>.singleton.Doc.XBagDoc.Init(roPtc.Data.roleData.Bag);
			XSingleton<XStageProgress>.singleton.Init(roPtc.Data.roleData.Stages);
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process4 ", null, null, null, null, null);
			XMainInterfaceDocument specificDocument2 = XDocuments.GetSpecificDocument<XMainInterfaceDocument>(XMainInterfaceDocument.uuID);
			specificDocument2.BackFlow = roPtc.Data.backflow_firstenter;
			XSingleton<XTutorialMgr>.singleton.Reset(roPtc.Data.roleData.Brief.tutorialBitsArray);
			XTaskDocument specificDocument3 = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
			specificDocument3.TaskRecord.InitFromServerData(roPtc.Data.roleData.task_record);
			//zcg XGuildDailyTaskDocument specificDocument4 = XDocuments.GetSpecificDocument<XGuildDailyTaskDocument>(XGuildDailyTaskDocument.uuID);
			//zcg specificDocument4.InitFromServerData(roPtc.Data.roleData.task_record);
			//zcg XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process5 ", null, null, null, null, null);
			//zcg XTempActivityDocument specificDocument5 = XDocuments.GetSpecificDocument<XTempActivityDocument>(XTempActivityDocument.uuID);
			//zcg specificDocument5.InitActivityRecordFromServerData(roPtc.Data.roleData.spActivityRecord);
			//zcg WeekEndNestDocument.Doc.OfflineOpenSetTaskId();
			//zcg XEmblemDocument specificDocument6 = XDocuments.GetSpecificDocument<XEmblemDocument>(XEmblemDocument.uuID);
			//zcg specificDocument6.InitWhenCreateRole(roPtc.Data.roleData.Brief.level);
			XCharacterEquipDocument specificDocument7 = XDocuments.GetSpecificDocument<XCharacterEquipDocument>(XCharacterEquipDocument.uuID);
			specificDocument7.UpdateRedPoints(roPtc.Data.roleData.Brief.level);
			//zcg ArtifactBagDocument.Doc.UpdateRedPoints(roPtc.Data.roleData.Brief.level);
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process6 ", null, null, null, null, null);
			XCharacterItemDocument specificDocument8 = XDocuments.GetSpecificDocument<XCharacterItemDocument>(XCharacterItemDocument.uuID);
			specificDocument8.UpdateRedPoints(roPtc.Data.roleData.Brief.level);
			//zcg XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process55 ", null, null, null, null, null);
			//zcg XAchievementDocument specificDocument9 = XDocuments.GetSpecificDocument<XAchievementDocument>(XAchievementDocument.uuID);
			//zcg specificDocument9.InitAchivement((roPtc.Data.roleData.achieve == null) ? null : roPtc.Data.roleData.achieve.oldachievement);
			//zcg XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process56 ", null, null, null, null, null);
			//zcg XPurchaseDocument specificDocument10 = XDocuments.GetSpecificDocument<XPurchaseDocument>(XPurchaseDocument.uuID);
			//zcg specificDocument10.InitPurchaseInfo(roPtc.Data.roleData.BuyInfo);
			//zcg XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process57 ", null, null, null, null, null);

			if (roPtc.Data.roleData.fashionrecord == null)
            {
				roPtc.Data.roleData.fashionrecord = new KKSG.FashionRecord();

			}
            //zcg 
            // 			{
            // 				//if(roPtc.Data.roleData.fashionrecord.bagfashion != null)
            // 				{
            //                     XFashionDocument specificDocument11 = XDocuments.GetSpecificDocument<XFashionDocument>(XFashionDocument.uuID);
            //                     specificDocument11.Init(roPtc.Data.roleData.fashionrecord.bagfashion, roPtc.Data.roleData.fashionrecord.bodyfashion, roPtc.Data.roleData.fashionrecord.collected);
            //                 }
            //                 XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process58 ", null, null, null, null, null);
            //                 XFashionStorageDocument specificDocument12 = XDocuments.GetSpecificDocument<XFashionStorageDocument>(XFashionStorageDocument.uuID);
            //                 specificDocument12.Init(roPtc.Data.roleData.fashionrecord);
            //             }

            //zcg  todo:
			XSingleton<XAttributeMgr>.singleton.XPlayerData.Outlook.SetFashionData(roPtc.Data.roleData.fashionrecord.display_fashion, roPtc.Data.roleData.fashionrecord.hair_color_id, roPtc.Data.roleData.fashionrecord.special_effects_id, true);
            XSingleton<XAttributeMgr>.singleton.XPlayerData.Outlook.CalculateOutLookFashion();

            //zcg XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process7 ", null, null, null, null, null);
            //zcg XPrerogativeDocument specificDocument13 = XDocuments.GetSpecificDocument<XPrerogativeDocument>(XPrerogativeDocument.uuID);
            //zcg specificDocument13.Initialize(roPtc.Data.roleData.payv2.consume.setid, roPtc.Data.roleData.payv2.consume.activateid);
            XSingleton<XUICacheMgr>.singleton.Init();
			//zcg XPetDocument specificDocument14 = XDocuments.GetSpecificDocument<XPetDocument>(XPetDocument.uuID);
			//zcg specificDocument14.OnPetAllNotify(roPtc.Data.roleData.petsys);
			//zcg XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process8 ", null, null, null, null, null);
			//zcg XCardCollectDocument specificDocument15 = XDocuments.GetSpecificDocument<XCardCollectDocument>(XCardCollectDocument.uuID);
			//zcg specificDocument15.InitCardData(roPtc.Data.roleData.atlas);
			//zcg XAbyssPartyDocument specificDocument16 = XDocuments.GetSpecificDocument<XAbyssPartyDocument>(XAbyssPartyDocument.uuID);
			if (roPtc.Data.roleData.Stages.absparty != null)
			{
				//zcg specificDocument16.SetAbyssIndex(roPtc.Data.roleData.Stages.absparty.aby);
			}
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process9 ", null, null, null, null, null);
			//zcg XTitleDocument specificDocument17 = XDocuments.GetSpecificDocument<XTitleDocument>(XTitleDocument.uuID);
			//zcg specificDocument17.RefreshTitleLevelUp();
			//zcg XPartnerDocument.Doc.ReqPartnerInfo();
			//zcg XNPCFavorDocument specificDocument18 = XDocuments.GetSpecificDocument<XNPCFavorDocument>(XNPCFavorDocument.uuID);
			//zcg specificDocument18.ReqNPCFavorUnionInfo();
			//zcg XSpriteSystemDocument specificDocument19 = XDocuments.GetSpecificDocument<XSpriteSystemDocument>(XSpriteSystemDocument.uuID);
			//zcg specificDocument19.SetAllInfo(roPtc.Data.roleData.SpriteRecord);
			//zcg XHeroBattleDocument specificDocument20 = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
			//zcg specificDocument20.SetHeroBattleInfo(roPtc.Data.roleData.herobattle);
			//zcg XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process10 ", null, null, null, null, null);
			//zcg XQualifyingDocument specificDocument21 = XDocuments.GetSpecificDocument<XQualifyingDocument>(XQualifyingDocument.uuID);
			//zcg specificDocument21.SetQulifyingRewardCount(roPtc.Data.roleData.pkrecord);
			if (!string.IsNullOrEmpty(XSingleton<XLoginDocument>.singleton.OpenID))
			{
				//zcg XSingleton<XUpdater.XUpdater>.singleton.XTssSdk.OnLogin((int)XSingleton<XLoginDocument>.singleton.Channel, XSingleton<XLoginDocument>.singleton.OpenID, XSingleton<XClientNetwork>.singleton.ServerID, roPtc.Data.roleData.Brief.roleID.ToString());
			}
			//zcg XSingleton<XUpdater.XUpdater>.singleton.XApolloManager.Init((int)XSingleton<XLoginDocument>.singleton.Channel, XSingleton<XLoginDocument>.singleton.OpenID);
			XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendUserInfo(XSingleton<XClientNetwork>.singleton.ServerID, roPtc.Data.roleData.Brief.roleID);
			//zcg XSingleton<XUpdater.XUpdater>.singleton.XBroadCast.SetAccount((int)XSingleton<XLoginDocument>.singleton.Channel, XSingleton<XLoginDocument>.singleton.OpenID, XSingleton<XLoginDocument>.singleton.TokenCache);
			//zcg XSingleton<XUpdater.XUpdater>.singleton.XApolloManager.SetRealtimeMode();
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process11 ", null, null, null, null, null);
			//zcg XSingleton<XPandoraSDKDocument>.singleton.PandoraLogin();
			//zcg XSmeltDocument.Doc.InitEquipAndEmblemRedDot();
			//zcg XSmeltDocument.Doc.ResetSetting();
			//zcg ArtifactInscriptionDocument.Doc.ResetSetting();
			//zcg ArtifactFuseDocument.Doc.ResetSetting();
			//zcg ArtifactRecastDocument.Doc.ResetSetting();
			//zcg ArtifactRefinedDocument.Doc.ResetSetting();
			//zcg XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process12 ", null, null, null, null, null);
			XFileLog.RoleName = roPtc.Data.roleData.Brief.name;
			//zcg XPlatformAbilityDocument.Doc.QueryQQVipInfo();
			//zcg XRechargeDocument specificDocument22 = XDocuments.GetSpecificDocument<XRechargeDocument>(XRechargeDocument.uuID);
			//zcg specificDocument22.GetPayMarketingInfo();
			//zcg XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process13 ", null, null, null, null, null);
			//zcg XRechargeDocument specificDocument23 = XDocuments.GetSpecificDocument<XRechargeDocument>(XRechargeDocument.uuID);
			//zcg specificDocument23.PayParameterNtf();
			//zcg XMilitaryRankDocument specificDocument24 = XDocuments.GetSpecificDocument<XMilitaryRankDocument>(XMilitaryRankDocument.uuID);
			//zcg specificDocument24.SetMyMilitaryRecord(roPtc.Data.roleData.military);
			//zcg XFPStrengthenDocument specificDocument25 = XDocuments.GetSpecificDocument<XFPStrengthenDocument>(XFPStrengthenDocument.uuID);
			//zcg specificDocument25.RequsetFightNum();
			//zcg AdditionRemindDocument specificDocument26 = XDocuments.GetSpecificDocument<AdditionRemindDocument>(AdditionRemindDocument.uuID);
			//zcg if (roPtc.Data.roleData.misc != null)
			//zcg {
			//zcg specificDocument26.SetFreeflowTime(roPtc.Data.roleData.misc.freeflow_hinttime);
			//zcg }
			XSingleton<XReconnection>.singleton.SetPlayerInfo(roPtc.Data.roleData);
			XSingleton<XDebug>.singleton.AddLog("PtcG2C_SelectRoleNtf.Process14 ", null, null, null, null, null);
		}
	}
}
